<!-- 头部header组件 -->
<template>
  <div class="container">
    <!-- 左边 -->
    <div class="left">
      <img :src="img" alt="" />
      <span>学生管理后台</span>
    </div>
    <!-- 右边 -->
    <div>
      <ul class="right">
        <li class="dropdow">
          <el-dropdown @command="handleCommand">
            <span class="el-dropdown-link">
              你好,{{ role }}&nbsp;&nbsp;
              <img :src="logo" alt="" />
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="a">个人信息</el-dropdown-item>
              <el-dropdown-item command="b">修改信息</el-dropdown-item>
              <el-dropdown-item command="c">退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
// 引入img 图片
import logoImg from "@/assets/logo.png";
import logo from "@/assets/images/logo.jpg";
// 引入cookie方法
import { removeCookie } from "@/utils/cookie";
export default {
  name: "",
  props: [""],
  data() {
    return {
      img: logoImg,
      logo: logo,
      role: localStorage.getItem("role"),
    };
  },

  components: {},

  computed: {},

  created() {},

  mounted() {},

  methods: {
    handleCommand(command) {
      if (command == "c") {
        removeCookie("token");
        this.$router.go(0);
      }
    },
  },
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
.container {
  display: flex;
  justify-content: space-between;
  height: 60px;
  width: 100%;
  align-items: center;
  .left {
    width: 180px;
    height: 100%;
    display: flex;
    align-items: center;
    img {
      height: 36px;
      width: 36px;
    }
    span {
      font-size: 24px;
      font-weight: bold;
    }
  }
  .right {
    flex: 1;
    height: 60px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    i {
      fill: #51c332;
    }
    img {
      width: 24px;
      height: 24px;
    }
    .icon {
      width: 55px;
      text-align: center;
      .wxicon {
        width: 24px;
        height: 24px;
        fill: #51c332;
      }
    }
    .tabEle {
      width: 36px;
    }
    .dropdow {
      width: 124px;
      /deep/.el-dropdown-link {
        display: flex;
        align-items: center;
        color: #383a3f;
      }
    }
  }
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
</style>
